﻿using System;
using System.Xml.Serialization;
using cndp.Model.IModel;

namespace cndp.Model
{
    /// <summary>
    /// Judge - Denna klass ärver information från 'Person'. Den lägger även till information om vilket domarförbund domaren tillhör.
    /// </summary>
    [Serializable]
    public class Judge : Person, IJudge
    {
        #region Variabels/Properties

        [XmlElement("AFFILLIATE")]
        public string Affilliate { get; set; }

        #endregion

        #region Constructor

        public Judge()
        {
            Affilliate = "";
        }

        public Judge(string name, string gender, string personalCodeNumber, string nationality, string affilliate)
            : base(name, gender, personalCodeNumber, nationality)
        {
            Affilliate = affilliate;
        }

        #endregion

        #region Equals override

        public override bool Equals(object obj)
        {
            if (obj == null) return false;
            var objAsJudge = obj as Judge;
            if (objAsJudge == null) return false;
            return Equals(objAsJudge);
        }

        public bool Equals(Judge other)
        {
            if (other == null) return false;
            return (PersonalCodeNumber.Equals(other.PersonalCodeNumber));
        }

        #endregion
    }
}